package com.easygo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.easygo.pojo.Content;
import com.easygo.service.ContentService;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Scope("prototype")
public class ContentController {

    @Resource
    ContentService contentService;

    @GetMapping("/content_list/{categoryId}")
    public List<Content> getContentsByCategoryId(@PathVariable("categoryId") Long categoryId){
        return contentService.list(new QueryWrapper<Content>().eq("category_id",categoryId).eq("status",0).eq("del",0).orderByAsc("sort_order"));
    }
}
